package com.wuercloud.mq;

/**
 * Created by JiangWL on 2017/3/23.
 */
public class MqTest {
    public static void main(String[] args) {
        /*List<String> zhoushanList = new ArrayList<>(100000);
        List<String> yfkjList = new ArrayList<>(100000);*//*
        Map<String,String> map = new TreeMap<>();

        for (int i=0;i<1000;i++){
            String str = "舟山信息测试"+i;
            String yfkjStr = "云锋信息测试"+i;
            map.put("yfkj"+i,yfkjStr);
            map.put("zhoushan"+i,str);

            *//*zhoushanList.add(str);
            yfkjList.add(yfkjStr);*//*
        }
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RabbitmqConfiguration.class);
        SendInvoker invoker = (SendInvoker) context.getBean("wawaMqSendInvoker");

        map.keySet().parallelStream().forEach(key->{
            String msg = map.get(key);
            if (key.startsWith("yfkj")){
                invoker.send(msg,"SMS-DOOR-YFKJ","30000");
            }else {
                invoker.send(msg,"SMS-DOOR-ZHOUSHAN","30000");
            }
            System.out.println(key);
        });
        map.clear();*/
        /*zhoushanList.parallelStream().forEach((msg)->invoker.send(msg,"SMS-DOOR-ZHOUSHAN","60000"));
        yfkjList.parallelStream().forEach((msg)->invoker.send(msg,"SMS-DOOR-YFKJ","60000"));*/

        //ConsumerHandler consumerHandler = (ConsumerHandler)context.getBean("consumerHandler");
        /*try {
            consumerHandler.receiveTask("SMS-DOOR-ZHOUSHAN");
            consumerHandler.receiveTask("SMS-DOOR-YFKJ");
        } catch (Exception e) {
            e.printStackTrace();
        }*/
    }
}
